<?php
class Controller
{
	protected $_model;
	protected $_action;
	protected $_template;
	protected $_controller;
	protected $data;
	
	public function beforeFilter()
	{
		if(isset($_POST) && !empty($_POST))
		{
			$this->data = $_POST;
		}
	}
	
	public function __construct($controller, $model, $action)
	{
		$this->_controller = $controller;
		$this->_model = $model;
		$this->_action = $action;
		$this->$model = new $model();
		$this->_template = new Template($controller, $action);
	}
	
	public function redirect($controller, $action)
	{
		header( 'Location: http://localhost/myfrwrk/'.$controller.'/'.$action.'' ) ;
		exit;
	}
	
	public function set($name, $value)
	{
		$this->_template->set($name, $value);
	}
	
	public function __destruct()
	{
		$this->_template->render();
	}

}